{extend name="../back" /}
{block name="main"}
<div class="w-100 d-flex justify-content-start align-items-center mb-3">
  <div class="btn-group btn-group-sm me-4" role="group">
    <a class="btn btn-secondary" href="{:dcUrl('admin/users/index')}"><i class="iconfont icon-list-alt mx-1"></i></a>
    <a class="btn btn-secondary" href="{:dcUrl('admin/users/create')}"><i class="iconfont icon-plus mx-1"></i></a>
    <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown"><i class="iconfont icon-filter"></i></button>
    <div class="dropdown-menu">
      <a class="dropdown-item" href="{:dcUrl('admin/users/index',['sortOrder'=>'user_id'])}">ID</a>
      <a class="dropdown-item" href="{:dcUrl('admin/users/index',['sortOrder'=>'user_score'])}">积分</a>
    </div>
  </div>
  <form action="{:dcUrl('admin/users/index')}" method="get">
    <div class="input-group input-group-sm">
      <input  class="form-control" type="text" name="searchText" placeholder="邮箱/手机号/用户名" autocomplete="off" required>
      <button class="btn btn-secondary" type="submit">搜索</button>
    </div>
  </form>
</div>
<table class="table table-striped table-bordered table-hover">
  <thead>
    <tr>
      <th>ID</th>
      <th>用户名</th>
      <th>手机号</th>
      <th>邮箱</th>
      <th>积分</th>
      <th>状态</th>
      <th>角色</th>
      <th>PID</th>
      <th>注册时间</th>
      <th>登录时间</th>
      <th>注册IP</th>
      <th>登录IP</th>
      <th>操作</th>
    </tr>
  </thead>
  <tbody>
    {volist name="list" id="item"}
    <tr>
      <td>{$item.user_id}</td>
      <td>{$item.user_name}</td>
      <td>{$item.user_mobile}</td>
      <td>{$item.user_email|default='-'}</td>
      <td>{$item.user_score}</td>
      <td>{$item.user_status}</td>
      <td>{:implode(',',json_decode($item['user_roles'],true))}</td>
      <td>{$item.user_pid}</td>
      <td>{$item.user_create_time|date='Y-m-d H:i:s'}</td>
      <td>{$item.user_update_time|date='Y-m-d H:i:s'}</td>
      <td>{$item.user_create_ip}</td>
      <td>{$item.user_update_ip}</td>
      <td>
        <a class="text-muted" href="{:dcUrl('admin/users/delete',['id'=>$item['user_id']])}" data-toggle="delete">删除</a>
        <a href="{:dcUrl('admin/users/edit',['id'=>$item['user_id']])}" data-toggle="edit">修改</a>
      </td>
    </tr>
  {/volist}
  </tbody>
</table>
{$pages|raw}
{/block}